package com.blackhorse;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * 订单微服务启动类
 */
@SpringBootApplication
@EnableDiscoveryClient //激活nacos客户端
@EnableFeignClients //激活Feign客户端
public class OrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }

    @Bean
//    @LoadBalanced //使用ribbon负载均衡：注意，使用dubbo时不能开启该注解，否则应用启动失败
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
